#ifndef __HARD_SPI_H
#define __HARD_SPI_H

#include "stm32f10x.h"

#define HARD_SPIx							SPI1
#define HARD_SPI_PORT						GPIOA
#define HARD_SPI_CLK_PIN					GPIO_Pin_5
#define HARD_SPI_MISO_PIN					GPIO_Pin_6
#define HARD_SPI_MOSI_PIN					GPIO_Pin_7

#define HARD_SPI_DMAx						DMA1
#define HARD_SPI_RX_DMA_CHANNEL				DMA1_Channel2
#define HARD_SPI_RX_DMA_CHANNEL_IRQn		DMA1_Channel2_IRQn
#define HARD_SPI_RX_DMA_IT					DMA1_IT_TC2
#define HARD_SPI_RX_FLAG					DMA1_FLAG_TC2
#define HARD_SPI_TX_DMA_CHANNEL				DMA1_Channel3
#define HARD_SPI_TX_DMA_CHANNEL_IRQn		DMA1_Channel3_IRQn
#define HARD_SPI_TX_DMA_IT					DMA1_IT_TC3
#define HARD_SPI_TX_FLAG					DMA1_FLAG_TC3
#define HARD_SPI_DR_ADDRESS					(SPI1->DR)

int16_t SPI_SendData(uint16_t Data);
int16_t SPI_ReadData(void);
void SPI_Config(void);


#endif //__HARD_SPI_H

